bitkeeper revision 1.403 (3f575ebaoJ7dB2rgSY4sqPbfOQLFxA)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 4 Sep 2003 15:48:10 +0000 (15:48 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 4 Sep 2003 15:48:10 +0000 (15:48 +0000)
time.h, time.c, setup.c, apic.c:
  Fixes for machines with no local APIC.

xen/arch/i386/apic.c
xen/arch/i386/setup.c
xen/arch/i386/time.c
xen/include/xeno/time.h

index 3aff8aa9932341b941aec7a41f32f4f9ea8b9631..ecc96eab2f28bc323a334752d4057e496888b228 100644 (file)
@@ -486,7 +486,6 @@ void __init init_apic_mappings(void)
 static unsigned int bus_freq;
 static u32          bus_cycle;   /* length of one bus cycle in pico-seconds */
 static u32          bus_scale;   /* scaling factor convert ns to bus cycles */
-u64 cpu_freq;
 
 /*
  * The timer chip is already set up at HZ interrupts per second here,
@@ -616,7 +615,11 @@ int __init calibrate_APIC_clock(void)
            result / (1000000/HZ), 
            result % (1000000/HZ));
 
-    cpu_freq = (u64)(((t2-t1)/LOOPS)*HZ);
+    /*
+     * KAF: Moved this to time.c where it's calculated relative to the TSC. 
+     * Therefore works on machines with no local APIC.
+     */
+    /*cpu_freq = (u64)(((t2-t1)/LOOPS)*HZ);*/
 
     /* set up multipliers for accurate timer code */
     bus_freq   = result*HZ;
index 059d296568db76df5bc47c8ec1ec39c91d5cb5d8..4cc63616a7564457cae104713c55582f301915c4 100644 (file)
@@ -384,7 +384,11 @@ void __init start_of_day(void)
 #endif
     initialize_keytable(); /* call back handling for key codes      */
 
-    disable_pit();             /* not needed anymore */
+    if ( cpu_has_apic )
+        disable_pit();
+    else if ( smp_num_cpus != 1 )
+        panic("We really need local APICs on SMP machines!");
+
     ac_timer_init();    /* init accurate timers */
     init_xeno_time();  /* initialise the time */
     schedulers_start(); /* start scheduler for each CPU */
index 7d34bb409830fa1d3e2e025e228f908abd4c33d0..1797eb7d72863b2dc3f37deec6c8dc6ed151f7c4 100644 (file)
@@ -54,7 +54,8 @@ int timer_ack = 0;
 
 static unsigned int    rdtsc_bitshift;  /* Which 32 bits of TSC do we use?   */
 static unsigned long   init_cmos_time;  /* RTC time when system time == 0    */
-static u64             cpu_freqs[3];    /* Slow/correct/fast CPU freqs       */
+static u64             cpu_freqs[3];    /* Slow/correct/fast CPU frequencies */
+static u64             cpu_freq;        /* Currently-selected CPU frequency  */
 static u32             st_scale_f;      /* Cycles -> ns, fractional part     */
 static u32             st_scale_i;      /* Cycles -> ns, integer part        */
 static struct ac_timer update_timer;    /* Periodic 'time update' function   */
@@ -92,6 +93,7 @@ static inline void do_timer_interrupt(
     }
 #endif
     do_timer(regs);
+    do_ac_timer();
 }
 
 /*
@@ -501,6 +503,8 @@ void __init time_init(void)
     ticks_per_usec = ticks_per_frac / (1000000/CALIBRATE_FRAC);
     cpu_khz = ticks_per_frac / (1000/CALIBRATE_FRAC);
 
+    cpu_freq = (u64)ticks_per_frac * (u64)CALIBRATE_FRAC;
+
     printk("Detected %lu.%03lu MHz processor.\n", 
            cpu_khz / 1000, cpu_khz % 1000);
 
index 51b8a3eceef5ab091d08dd1122339b1568395d49..c30fe5614016810685fb024da7b678d793a490a2 100644 (file)
  */
 extern int init_xeno_time();
 
-/*
- * Cycle Counter Time (defined in asm/time.h)
- */
-
-
-extern u64     cpu_freq;
 
 /*
  * System Time